<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        // function add() {
        //     let li = document.createElement('li')
        //     let txt = document.createTextNode('测试')
        //     li.append(txt)
        //
        //     document.getElementsByTagName('ul')[0].append(li)
        // }

        function remove() {
            // 通过css选择器查找DOM对象
            document.querySelector('div span').remove()
        }
    </script>
</head>
<body>

    <div>
        <span>我是pan1</span>
    </div>

    <span>我是span2</span>

    <ul>
        <li>111</li>
        <li>222</li>
        <li>333</li>
    </ul>

    <button onclick="remove()">删除</button>

</body>
</html>